package com.gzx.fin.tech;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.bind.annotation.GetMapping;
import vip.xiaonuo.common.runner.AppStartupListener;

/**
 * SpringBoot方式启动类
 *
 * @author zjt
 * @date 2025-04-02 16:01:25
 */
@Slf4j
@EnableDiscoveryClient
@EnableScheduling
@MapperScan("com.gzx.plugin.fin.tech.mapper")
@SpringBootApplication(scanBasePackages = {"com.gzx.fin.tech", "com.gzx.plugin.fin.tech"})
public class GzxFinTechApp {

    /* 解决druid 日志报错：discard long time none received connection:xxx */
    static {
        System.setProperty("druid.mysql.usePingMethod", "false");
    }

    /**
     * 主启动函数
     *
     * @author xuyuxiang
     * @date 2022/7/30 21:42
     */
    public static void main(String[] args) {
        SpringApplication springApplication = new SpringApplication(GzxFinTechApp.class);
        springApplication.run(args);
        System.out.println("(金科评分模块启动成功");
        log.info(">>> {}", GzxFinTechApp.class.getSimpleName().toUpperCase() + " STARTING SUCCESS");
    }

    /**
     * 首页
     *
     * @author xuyuxiang
     * @date 2022/7/8 14:22
     **/
    @GetMapping("/")
    public String index() {
        return "WELCOME";
    }

    @Bean
    public AppStartupListener appStartupListener() {
        return new AppStartupListener();
    }
}
